<%@ page contentType="text/html; charset=utf-8" language="java"  errorPage="" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>NETCONF Development Toolkit</title>
	<meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
	<link rel="stylesheet" type="text/css" href="css/index.css"  />
	<link rel="stylesheet" type="text/css" href="css/register.css"  />
	<link rel="stylesheet" type="text/css" href="css/items.css"  />
	<link rel="stylesheet" type="text/css" href="<%=basePath%>/css/subItems.css" />
    <script type="text/javascript"  src="jstree-v.pre1.0/_lib/jquery.js"></script>
</head>
<style type="text/css">
    body{
	   margin:0px;
	   padding:0px;
	   }
   .loginDiv{
	   border:1px solid;
	   border-color:#B3B3B3 #EAEAEA #EAEAEA #B3B3B3;
	   width: 500px;
	   position:absolute;
	   display:block;
	   padding:5px;
   }
   .loginTitle{
	   font-size:24px;
	   color:#5aa608;
   }
   .loginSpan{
	   display:inline-block;
	   margin:0px 0px 8px 40px;;
	   width:120px;
	   text-align:left;
	   font-weight:bold;
   }
   .logonInput{
	   width:300px;
	   padding:2px;
	   height:20px;
   }
</style>
<body>
  <div class="mainContent" style="width:800px;padding-top:50px;">
     <div class="itemTitle loginTitle">输入工号就可以哦！</div>
       <form id="registerForm" action="RegisterServlet" method="post">
       <div class="ListItem">
          <span class="loginSpan">8&nbsp;位工号：</span><input type="text" class="logonInput" id="_empNo" name="_empNo"  />
       </div>
       <div class="ListItem">
          <span class="loginSpan">密&nbsp;&nbsp;&nbsp;&nbsp;码：</span><input type="password" class="logonInput" id="_password" name="_password"  />
       </div>
       <div class="ListItem">
          <span class="loginSpan">密码确认：</span><input type="password" class="logonInput" id="_password_comfit" name="_password_comfit"  />
       </div>
       <div class="ListItem" style="text-align:right;">
           <span class="loginSpan"> 
               <input type="button" id="registButton" value="注册" onclick="checkForm()" />
               <input type="reset" value="重填" />
           </span>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
           <a href="#" onclick="javascript:window.history.go(-1)"> &gt;&gt;&nbsp;&nbsp;后退</a>
           <span class="textSpan">&nbsp;</span>
       </div>
      <% if(null !=  request.getAttribute("msg") ){ %>
       <div class="ListItem" style="text-align:center;">
       <%=request.getAttribute("msg") %>
       </div>
      <%} %>
       </form>
  </div>
<script type="text/javascript" >
   function checkEmpNo(){
	   var empNo = document.getElementById("_empNo").value;
	   if(isNaN(empNo) ){
		   alert("请输入数字！");
		   return false;
	   }
	   if(empNo.length != 8){
		   alert("工号长度不正确，请重新输入！");
		   return false;
	   }
	   
	   return true;
   }
   function checkForm(){
       $("#_password").css("border-color","#000");
       $("#_password_comfit").css("border-color","#000");
       $("#_empNo").css("border-color","#000");
	   document.getElementById("_password").value
	   if("" == document.getElementById("_password").value){
	       alert("密码不能为空！");
	       $("#_password").css("border-color","#F00");
	       document.getElementById("_password").focus();
		   return false;
	   }else if ("" == document.getElementById("_empNo").value){
	       alert("工号不能为空！");
	       $("#_empNo").css("border-color","#F00");
	       document.getElementById("_empNo").focus();
		   return false;
	   }
	   
	   if(document.getElementById("_password").value !=  document.getElementById("_password_comfit").value){
	        alert("两次输入的密码不一致！");
		   return false;
	   }
	   
	   if(!checkEmpNo()){
		   return false;
	   }
	   
	   document.getElementById("registerForm").submit();
	   
   }
</script>
</body>
</html>
